<template>
  <HomePannel ref="target" title="新鲜好物" subTitle="新鲜出炉 品质靠谱">
    <template #right>
      <XtxMore path="/"></XtxMore>
    </template>
    <HomeCommonList :newData="newData" />
  </HomePannel>
</template>

<script>
import HomePannel from './home-panel.vue'
import HomeCommonList from './home-common-list.vue'

import { findNew } from '@/api/home'
import { ref } from 'vue'
import { useObserve } from '@/hook'
export default {
  components: {
    HomePannel,
    HomeCommonList
  },
  setup () {
    const newData = ref([])
    async function getNew () {
      const { result } = await findNew()
      console.log('新鲜', result)
      newData.value = result
    }
    // onMounted(() => {
    //   getNew()
    // })
    const { target } = useObserve(getNew)

    return { newData, target }
  }
}
</script>
